<?php
require_once '../../includes/global.php';
error_reporting(7);
$wcfg=Dga('wcfg',"web like '".$sitename."' and lg like '".$_SESSION[LG]."'");
$wcfg=json_decode($wcfg[wcfg],true);

$webconfig[lgconfig]=$wcfg['lang'];
$webconfig[num]=$wcfg['num'];

$priceInfo=Dga('infosort',"del!=1 and id='".$_GET['bdsortid']."'");


//生成表单
function creatForm($id){
	$newForm = new xajaxResponse();
	$form	=	<<<EQT
	
		<div>按区间调整价格</div>
		<div style="clear:both;">
			<form>
				<div style="float:left;">
				开始时间:<input type="text" id="startDate" name="startTime" value=""/>
		<img onclick="WdatePicker({el:$dp.$('startDate')})" src="../../jimu/My97/skin/datePicker.gif" width="16" height="22" align="absmiddle">
				
	     <input name="overDate" id="d12" type="text" value="" style="width:90px;"/>
		<img onclick="WdatePicker({el:$dp.$('overDate')})" src="../../jimu/My97/skin/datePicker.gif" width="16" height="22" align="absmiddle">
				</div>
			</form>
		</div>
EQT;
	$newForm -> addAppend('showDate','innerHTML',$form);
	return $newForm;
}
//处理表单
function pushDate($id,$form){
	$newDate = new xajaxResponse();
	if($form['price']==''){
 		$newDate->addScript("document.body.removeChild($('act'))");
 		$newDate->addScript("closeSub();");
		$newDate->alert('价格不能为空');
		return $newDate;
	}
	if(!is_numeric($form['price'])){
		$newDate->addScript("document.body.removeChild($('act'))");
 		$newDate->addScript("closeSub();");
		$newDate->alert('价格只能为数字');
		return $newDate;
	}
	$arr['type']=$_GET['bdparentid'];
	//$newDate->alert($form['startDate']);
	switch($id) {
		/*******************************************************
		* 按区间期
		*********************************************************/
		case 'qujian':
			unset($isnul);
			//$newDate->alert(strtotime($form['startDate']));
			if($form['startDate']==''){
				$newDate->addScript("document.body.removeChild($('act'))");
 		$newDate->addScript("closeSub();");
				$newDate->alert('开始时间不能为空');
 				$newDate->addScript("closeSub();");
				return $newDate;
			}
			if($form['overDate']==''){
				$newDate->addScript("document.body.removeChild($('act'))");
 				$newDate->addScript("closeSub();");
				$newDate->alert('结束时间不能为空');
 				$newDate->addScript("closeSub();");
				return $newDate;
			}
			$startDate=strtotime($form['startDate']);
			$overDate=strtotime($form['overDate']);
			$dateNum=($overDate-$startDate)/INT_DAY;
			//$newDate->alert($dateNum);
			for($i=0;$i<=$dateNum;$i++){
				$arr['date']	=	$startDate+$i*INT_DAY;
				$arr['bdb']		=	$form['bdb'];
				$arr['bdgid']	=	$form['bdgid'];
				$arr['price']	=	$form['price'];
				$arr['gid']		=	Bic();
				//查找是否设过当天的房型 的价格
				$isnul=Dga('price',"del!=1 and bdb='".$arr['bdb']."' and bdgid='".$arr['bdgid']."' and date like '".$arr['date']."'");
				!empty($isnul['gid'])?
				Du('price',$arr,'id',$isnul['id'])
				:
				Di('price',$arr);
				$newDate->append('act','innerHTML','日期为'.date('Y-m-d',$arr['date']).'的数据更新完成...<br />');
			}
			break;
		/*******************************************************
		* 按月
		*********************************************************/
		case 'month':
			unset($isnul);

			//获取input的数量
			$inpNum=0;
			foreach ($form as $keyn => $valuen){
				# code...
				if (strrpos($keyn,'month') !== false){
					# code...
					$inpNum++;
				}
			}
			if(strrpos($form['qixiang'],'.')!==false || !is_numeric($form['qixiang']) || $form['qixiang']>10) {
				$newDate->addScript("document.body.removeChild($('act'))");
				$newDate->alert('对不起,期限范围只能是整数,并小于10...');
 				$newDate->addScript("closeSub();");
				return $newDate;
			}
			if($form['qixiantype']=='') {
				$newDate->addScript("document.body.removeChild($('act'))");
				$newDate->alert('您的期限类型还没选,请在  年/月  中选择一项');
 				$newDate->addScript("closeSub();");
				return $newDate;
			}
			$ttm=explode('-',$form['startMonthDate']);
			$y=$ttm[0];
			$m=$ttm[1];
			//看看是月还是年,小数为月
			if($form['qixiantype']=='m') {//按月
				if($form['qixiang']<1.3 || 1) {//按月计数,不能大于12个月
					for($ms=0;$ms<$form['qixiang'];$ms=$ms+1) {
						//$newDate->alert($form['qixiang']);
						//查找是否设过当天的房型 的价格
						//$newDate->addScript("document.body.removeChild($('act'))");
						//$newDate->alert($ms);							
						//转换成整数(整月)
						$mss=$ms;
						$y==''?$y=date("Y",time()):'';

						
						//每个月有几个日期,就加几条数据!
						for ($nowNum = 0; $nowNum < $inpNum; $nowNum++){
							# code...
							//这里这个为匹配input的name而设
							$nowNum==0?$nowNum='':'';

							
							$d=$form['monthDate'.$nowNum];
							if(trim($d)=='')	continue;//添加了选项,又没写时间的,路过
							//当时间-日期 小过今天时,那么将从下月开始执行
							//date("d",time())<$form['monthDate'.$nowNum]?$m++:'';
							/*if ($d<date('d',time())){
								# code...
								//$m=$m+1;
							}*/
							//当时间--月份 轮转过12月份时的处理
							if($m>12) {
								$m=1;
								$y=$y+1;
							}
							
							//$newDate->alert($d);
							//$arr['date']	=	floor(time()/INT_MONTH)*INT_MONTH+$ms*INT_MONTH+INT_DAY*monthDate;
							$arr['date']	=	strtotime($y.'-'.$m.'-'.$d);
							if(date("d",$arr['date'])!=$d){
								$error.='<div style="font-size:13px;color:#7448FF;">'.$y.'年'.$m.'月'.$d.'日的数据没被更新,请往下查看错误信息!</div>';
								$newDate->append('act','innerHTML','<div style="color:red;">对不起,'.$y.'年'.$m.'月没有'.$d.'号,可能为闰月,本月价格将不被记录,请核实...</div>');
								continue;
							}
							$arr['bdb']		=	$form['bdb'];
							$arr['bdgid']	=	$form['bdgid'];
							$arr['price']	=	$form['price'.$nowNum];
							$arr['gid']		=	Bic();
							$isnul=Dga('price',"del!=1 and bdb='".$arr['bdb']."' and bdgid='".$arr['bdgid']."' and date like '".$arr['date']."'");
							
							($isnul!='')?
							Du('price',$arr,'id',$isnul['id'])
							:
							Di('price',$arr);
							
							$newDate->append('act','innerHTML','日期为'.date('Y-m-d',$arr['date']).'的数据更新完成...<br />');
						}
						$m++;
					}
					unset($y);
					unset($m);
					unset($d);//减少变量污染
				}else{
					$newDate->addScript("document.body.removeChild($('act'))");
					$newDate->alert('对不起,您输入的月数不能大于12个月,请查证后重新输入...');
 					$newDate->addScript("closeSub();");
					return $newDate;
				}
			}else{//按年
				$maxI=$form['qixiang']*12;

					for($i=1;$i<=$maxI;$i++) {

						/*原理同上,若要了解请往上看*/

						$y==''?$y=date("Y",time()):'';
						
						
						
						//每个月有几个日期,就加几条数据!
						for ($nowNum = 0; $nowNum < $inpNum; $nowNum++){
							# code...
							//这里这个为匹配input的name而设
							$nowNum==0?$nowNum='':'';
							
							
							
							$d=$form['monthDate'.$nowNum];
							if(trim($d)=='')	continue;//添加了选项,又没写时间的,路过
							
							//当时间--月份 轮转过12月份时的处理
							if($m>12) {
								$m=1;
								$y=$y+1;
							}
							//$arr['date']	=	floor(time()/INT_MONTH)*INT_MONTH+$ms*INT_MONTH+INT_DAY*monthDate;
							$arr['date']	=	strtotime($y.'-'.$m.'-'.$d);
							//$newDate->alert(date("d",$arr['date']));
							//$newDate->alert($form['monthDate'.$nowNum]);
							//return $newDate;
							if(date("d",$arr['date'])!=$form['monthDate'.$nowNum]){
								$error.='<div style="font-size:13px;color:#7448FF;">'.$y.'年'.$m.'月的数据没被更新,请往下查看错误信息!</div>';
								$newDate->append('act','innerHTML','<div style="color:red;">对不起,'.$y.'年'.$m.'月没有'.$form['monthDate'.$nowNum].'号,可能为闰月,本月价格将不被记录,请核实...</div>');
								continue;
							}
							$arr['bdb']		=	$form['bdb'];
							$arr['bdgid']	=	$form['bdgid'];
							$arr['price']	=	$form['price'];
							$arr['gid']		=	Bic();
							$isnul=Dga('price',"del!=1 and bdb='".$arr['bdb']."' and bdgid='".$arr['bdgid']."' and date like '".$arr['date']."'");
							($isnul!='')?
							Du('price',$arr,'id',$isnul['id'])
							:
							Di('price',$arr);
							$newDate->append('act','innerHTML','日期为'.date('Y-m-d',$arr['date']).'的数据更新完成...<br />');
						}
						$m++;
					}
					unset($y);
					unset($m);
					unset($d);//减少变量污染
			}
			break;
		/*******************************************************
		* 按星期
		*********************************************************/
		case 'week':
			unset($isnul);

			//开始时间和结束的时间
			$startWD=strtotime($form['startWeekDate']);
			$endWD=strtotime($form['endWeekDate']);
			$ttm=explode('-',$form['startWeekDate']);
			$y=$ttm[0];
			$m=$ttm[1];
			$d=$ttm[2];
			$d==''?$d=1:'';
			//看看是月还是年,小数为月
					for($startWD;$startWD<=$endWD;$startWD=$startWD+INT_DAY) {
						//$newDate->alert(date("w",$startWD));
							for ($v = 0; $v < 7; $v++){
								//$newDate->alert($v);
								if(date("w",$startWD)==$form['weekDate'.$v]) {
									$arr['date']	=	$startWD;
									$arr['bdb']		=	$form['bdb'];
									$arr['bdgid']	=	$form['bdgid'];
									$arr['price']	=	$form['price'];
									$arr['gid']		=	Bic();
									$isnul=Dga('price',"del!=1 and bdb='".$arr['bdb']."' and bdgid='".$arr['bdgid']."' and date like '".$arr['date']."'");
									($isnul!='')?
									Du('price',$arr,'id',$isnul['id'])
									:
									Di('price',$arr);
									$newDate->append('act','innerHTML','日期为'.date('Y-m-d',$arr['date']).'的数据更新完成...<br />');
								}
						
					unset($y);
					unset($m);
					unset($d);//减少变量污染
				}
			}
			break;
		/*******************************************************
		* 按准确日期
		*********************************************************/
		case 'day':
			unset($isnul);
				$arr['date']	=	strtotime($form['dayDate']);
				$arr['bdb']		=	$form['bdb'];
				$arr['bdgid']	=	$form['bdgid'];
				$arr['price']	=	$form['price'];
				$arr['gid']		=	Bic();
				//查找是否设过当天的房型 的价格
				$isnul=Dga('price',"del!=1 and bdb='".$arr['bdb']."' and bdgid='".$arr['bdgid']."' and date like '".$arr['date']."'");
				($isnul!='')?
				Du('price',$arr,'id',$isnul['id'])
				:
				Di('price',$arr);
				//$newDate->alert('更新完成');
			
			break;
	}

	($error=='')?$finishMsg='<div style="color:#69B458;">所有的数据都更新完成</div>':$finishMsg='数据更新完成'.$error;
	$newDate->assign('zhuangtai','innerHTML',$finishMsg);
	$newDate->append('act','innerHTML','<div style="font-size:19px;color:#008000;">所有的数据都处理完成!<br />(点击窗口可关闭)...</div><br />');
	$newDate->addEvent('act',"onclick","document.body.removeChild($('act'))");
	$newDate->addScript("closeSub();");
	return $newDate->getXML();
}


$xajax = new xajax(); 
//$xajax->bDecodeUTF8Input=true;

$xajax->registerFunction("creatForm");
$xajax->registerFunction("pushDate");
$xajax->processRequests();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Prosperous JIMU</title>
<script language="javascript" type="text/javascript" src="../../jimu/My97/WdatePicker.js"></script>
 <script type="text/javascript">
 <!--
	function $(v){
	var a=document.getElementById(v);
	a==''?a=document.getElementByTagName(v):'';
	a==''?a=document.getElementByClassName(v):'';
	return a;
}
 //-->
 </script>
	<?php
        $xajax->printJavascript('/includes/class/xajax/');
    ?>
<style type="text/css">

* {
	margin: 0; padding:0;
}
body,html{height:100%;}
body {
	margin-top: 10px;
	margin-right: auto;
	margin-left: auto;
	margin-bottom:10px;
	text-align: center;
	width: 95%;
	background-color: #666666;
	font-size: 12px;
	color: #000000;
}
#container {
	text-align: left;
	width: auto;
	background-color: #FFFFFF;
	padding:20px;
	

}

#container #title {
	height: 28px;
}
#container #title li {
	float: left;
	list-style-type: none;
	height: 28px;
	line-height: 28px;
	text-align: center;
	margin-right: 1px;

}
#container #title ul {
	background-color: #FFFFFF;
	height: 28px;
}
#container #title a {
	text-decoration: none;
	color: #000000;
	display: block;
	width: auto;
	background: url(../images/tab_selected_left_bk2.gif) no-repeat left -29px;
}
#container #title a span{
	display: block;
	background: url(../images/tab_selected_right_bk2.gif) no-repeat right -29px;
	padding: 0 15px 0 15px;
}
#container #title #tag1 a:hover {
	text-decoration: none;
	color: #ffffff;
	display: block;
	width: auto;
	background: url(../images/tab_selected_left_bk2.gif) no-repeat left -87px;
}
#container #title #tag1 a:hover span{
	display: block;
	background: url(../images/tab_selected_right_bk2.gif) no-repeat right -87px;
	padding: 0 15px 0 15px;
}
#container #title #tag2 a:hover {
	text-decoration: none;
	color: #ffffff;
	display: block;
	width: auto;
	background: url(../images/tab_selected_left_bk2.gif) no-repeat left 0px;
}
#container #title #tag2 a:hover span{
	display: block;
	background: url(../images/tab_selected_right_bk2.gif) no-repeat right 0px;
	padding: 0 15px 0 15px;	
}
#container #title #tag3 a:hover {
	text-decoration: none;
	color: #ffffff;
	display: block;
	width: auto;
	background: url(../images/tab_selected_left_bk2.gif) no-repeat left -58px;
}
#container #title #tag3 a:hover span{
	display: block;
	background: url(../images/tab_selected_right_bk2.gif) no-repeat right -58px;
	padding: 0 15px 0 15px;	
}
#container #title #tag4 a:hover {
	text-decoration: none;
	color: #ffffff;
	display: block;
	width: auto;
	background: url(../images/tab_selected_left_bk2.gif) no-repeat left -145px;
}
#container #title #tag4 a:hover span{
	display: block;
	background: url(../images/tab_selected_right_bk2.gif) no-repeat right -145px;
	padding: 0 15px 0 15px;
}
#container #title #tag5 a:hover {
	text-decoration: none;
	color: #ffffff;
	display: block;
	width: auto;
	background: url(../images/tab_selected_left_bk2.gif) no-repeat left -174px;
}
#container #title #tag5 a:hover span{
	display: block; 
	background: url(../images/tab_selected_right_bk2.gif) no-repeat right -174px;
	padding: 0 15px 0 15px;
}
#container #title #tag6 a:hover span{
	display: block; 
	background: url(../images/tab_selected_right_bk2.gif) no-repeat right -203px;
	padding: 0 15px 0 15px;
}#container #title #tag6 a:hover {
	text-decoration: none;
	color: #ffffff;
	display: block;
	width: auto;
	background: url(../images/tab_selected_left_bk2.gif) no-repeat left -203px;
}
#container #title #tag7 a:hover span{
	display: block; 
	background: url(../images/tab_selected_right_bk2.gif) no-repeat right -232px;
	padding: 0 15px 0 15px;
}#container #title #tag7 a:hover {
	text-decoration: none;
	color: #ffffff;
	display: block;
	width: auto;
	background: url(../images/tab_selected_left_bk2.gif) no-repeat left -232px;
}
#container #title #tag8 a:hover span{
	display: block; 
	background: url(../images/tab_selected_right_bk2.gif) no-repeat right -261px;
	padding: 0 15px 0 15px;
}#container #title #tag8 a:hover {
	text-decoration: none;
	color: #ffffff;
	display: block;
	width: auto;
	background: url(../images/tab_selected_left_bk2.gif) no-repeat left -261px;
}
#container #title #tag9 a:hover span{
	display: block; 
	background: url(../images/tab_selected_right_bk2.gif) no-repeat right -116px;
	padding: 0 15px 0 15px;
}#container #title #tag9 a:hover {
	text-decoration: none;
	color: #ffffff;
	display: block;
	width: auto;
	background: url(../images/tab_selected_left_bk2.gif) no-repeat left -116px;
}
#container #title .selectli1 {
	text-decoration: none;
	color: #ffffff;
	display: block;
	width: auto;
	background: url(../images/tab_selected_left_bk2.gif) no-repeat left -87px;
}
#container #title a .selectspan1 {
	display: block;
	background: url(../images/tab_selected_right_bk2.gif) no-repeat right -87px; 
	padding: 0 15px 0 15px;
}
#container #title .selectli2 {
	text-decoration: none;
	color: #ffffff;
	display: block;
	width: auto;
	background: url(../images/tab_selected_left_bk2.gif) no-repeat left 0px;
}
#container #title a .selectspan2 {
	display: block; 

	background: url(../images/tab_selected_right_bk2.gif) no-repeat right 0px; 
	padding: 0 15px 0 15px;
}
#container #title .selectli3 {
	text-decoration: none;
	color: #ffffff;
	display: block;
	width: auto;
	background: url(../images/tab_selected_left_bk2.gif) no-repeat left -58px;
}
#container #title a .selectspan3 {
	display: block; 
	background: url(../images/tab_selected_right_bk2.gif) no-repeat right -58px; 
	padding: 0 15px 0 15px;
}
#container #title .selectli4 {
	text-decoration: none;
	color: #ffffff;
	display: block;
	width: auto;
	background: url(../images/tab_selected_left_bk2.gif) no-repeat left -145px;
}
#container #title a .selectspan4 {
	display: block; 
	background: url(../images/tab_selected_right_bk2.gif) no-repeat right -145px; 
	padding: 0 15px 0 15px;
}
#container #title .selectli5 {
	text-decoration: none;
	color: #ffffff;
	display: block;
	width: auto;
	background: url(../images/tab_selected_left_bk2.gif) no-repeat left -174px;
}
#container #title a .selectspan5 {
	display: block; 
	background: url(../images/tab_selected_right_bk2.gif) no-repeat right -174px; 
	padding: 0 15px 0 15px;
}
#container #title .selectli6 {
	text-decoration: none;
	color: #ffffff;
	display: block;
	width: auto;
	background: url(../images/tab_selected_left_bk2.gif) no-repeat left -203px;
}
#container #title a .selectspan6 {
	display: block; 
	background: url(../images/tab_selected_right_bk2.gif) no-repeat right -203px; 
	padding: 0 15px 0 15px;
}
#container #title .selectli7 {
	text-decoration: none;
	color: #ffffff;
	display: block;
	width: auto;
	background: url(../images/tab_selected_left_bk2.gif) no-repeat left -232px;
}
#container #title a .selectspan7 {
	display: block; 
	background: url(../images/tab_selected_right_bk2.gif) no-repeat right -232px; 
	padding: 0 15px 0 15px;
}
#container #title .selectli8 {
	text-decoration: none;
	color: #ffffff;
	display: block;
	width: auto;
	background: url(../images/tab_selected_left_bk2.gif) no-repeat left -261px;
}
#container #title a .selectspan8 {
	display: block; 
	background: url(../images/tab_selected_right_bk2.gif) no-repeat right -261px; 
	padding: 0 15px 0 15px;
}
#container #content ul {margin: 10px;}
#container #content li {margin: 5px; }
#container #content li img {margin: 5px;display:block;}
#container #content {
	padding: 10px;
}
.content1 {
	border-top-width: 3px;
	border-right-width: 1px;
	border-bottom-width: 1px;
	border-left-width: 1px;
	border-top-style: solid;
	border-right-style: solid;
	border-bottom-style: solid;
	border-left-style: solid;
	border-top-color: #3A81C8;
	border-right-color: #3A81C8;
	border-bottom-color: #3A81C8;
	border-left-color: #3A81C8;
	background-color: #DFEBF7;

}
.content2 {
	border-top-width: 3px;
	border-right-width: 1px;
	border-bottom-width: 1px;
	border-left-width: 1px;
	border-top-style: solid;
	border-right-style: solid;
	border-bottom-style: solid;
	border-left-style: solid;
	border-top-color: #ff950b;
	border-right-color: #ff950b;
	border-bottom-color: #ff950b;
	border-left-color: #ff950b;
	background-color: #FFECD2;
}
.content3 {
	padding: 10px;
	border-top-width: 3px;
	border-right-width: 1px;
	border-bottom-width: 1px;
	border-left-width: 1px;
	border-top-style: solid;
	border-right-style: solid;
	border-bottom-style: solid;
	border-left-style: solid;
	border-top-color: #FE74B8;
	border-right-color: #FE74B8;
	border-bottom-color: #FE74B8;
	border-left-color: #FE74B8;
	background-color: #FFECF5;
}
.content4 {
	
	padding: 10px;
	border-top-width: 3px;
	border-right-width: 1px;
	border-bottom-width: 1px;
	border-left-width: 1px;
	border-top-style: solid;
	border-right-style: solid;
	border-bottom-style: solid;
	border-left-style: solid;
	border-top-color: #00988B;
	border-right-color: #00988B;
	border-bottom-color: #00988B;
	border-left-color: #00988B;
	background-color: #E8FFFD;
}
.content5 {
	
	padding: 10px;
	border-top-width: 3px;
	border-right-width: 1px;
	border-bottom-width: 1px;
	border-left-width: 1px;
	border-top-style: solid;
	border-right-style: solid;
	border-bottom-style: solid;
	border-left-style: solid;
	border-top-color: #A8BC1F;
	border-right-color: #A8BC1F;
	border-bottom-color: #A8BC1F;
	border-left-color: #A8BC1F;
	background-color: #F7FAE2;
}
.content6 {
	
	padding: 10px;
	border-top-width: 3px;
	border-right-width: 1px;
	border-bottom-width: 1px;
	border-left-width: 1px;
	border-top-style: solid;
	border-right-style: solid;
	border-bottom-style: solid;
	border-left-style: solid;
	border-top-color: #DA572E;
	border-right-color: #DA572E;
	border-bottom-color: #DA572E;
	border-left-color: #DA572E;
	background-color: #FEDDD3;
}
.content7 {
	
	padding: 10px;
	border-top-width: 3px;
	border-right-width: 1px;
	border-bottom-width: 1px;
	border-left-width: 1px;
	border-top-style: solid;
	border-right-style: solid;
	border-bottom-style: solid;
	border-left-style: solid;
	border-top-color: #7F5755;
	border-right-color: #7F5755;
	border-bottom-color: #7F5755;
	border-left-color: #7F5755;
	background-color: #E4D0CF;
}
.content8 {
	
	padding: 10px;
	border-top-width: 3px;
	border-right-width: 1px;
	border-bottom-width: 1px;
	border-left-width: 1px;
	border-top-style: solid;
	border-right-style: solid;
	border-bottom-style: solid;
	border-left-style: solid;
	border-top-color: #cc91ff;
	border-right-color: #cc91ff;
	border-bottom-color: #cc91ff;
	border-left-color: #cc91ff;
	background-color: #ddddff;
}
.content9 {
	
	padding: 10px;
	border-top-width: 3px;
	border-right-width: 1px;
	border-bottom-width: 1px;
	border-left-width: 1px;
	border-top-style: solid;
	border-right-style: solid;
	border-bottom-style: solid;
	border-left-style: solid;
	border-top-color: #e08a00;
	border-right-color: #e08a00;
	border-bottom-color: #e08a00;
	border-left-color: #e08a00;
	background-color: #eeffcc;
}

.hidecontent {display:none;}

.price{
	clear:both;
	width:100%;
	margin-top:30px;
	padding-bottom:5px;
	border-bottom:2px dashed #fff;
}

.fontC{
	float:left;
	width:70px;
	margin-top:2px;
	text-align:left;
}
#act{z-index:1000;}
.at{clear:both;height:16px;}
.setdate{
	float:left;min-width:110px !important;width:110px;height:50px;border-right:1px #fff dashed";
}
</style>
</head>
<body>
<div id="container">
<div id="title">
    <ul>
	<?php $i=1;
	    foreach($webconfig[lgconfig] as $key =>$lg){
		         if($i==1){
				 $temp1="class=\"selectli".$i."\"";
				 $temp2="class=\"selectspan".$i."\"";
				 }else{
				 $temp1="";
				 $temp2="";
				 }
				
		echo "<li id=\"tag".$i."\"><a href=\"#\" onclick=\"switchTag('tag".$i."','content".$i."');this.blur();\" ".$temp1."><span ".$temp2.">".$lg."</span></a></li>";
		$i++;
		}
	
	?>
    </ul>
  </div>


<script type="text/javascript">
<!--
	function $(v){
		var a=document.getElementById(v);
		a==''?a=document.getElementByTagName(v):'';
		a==''?a=document.getElementByClassName(v):'';
		return a;
	}
	function changeColor(){
		var msglen=document.getElementsByTagName("input");
		var msglenl=msglen.length;
		for(var i=0;i<msglenl;i++){
		  if (msglen[i].type=="radio" || msglen[i].type=="checkbox"){
			  if(msglen[i].checked==true){
				$(msglen[i].id+'l').style.color='red';
			  }else{
				$(msglen[i].id+'l').style.color='#000';
			  }
		  }
		}
	}
	//close the submit of input
	function closeSub(){
		//下面的是用于将提交按鍵关闭
		var ai=document.getElementsByTagName("input");
		var ail=ai.length;
		for(var iz=0;iz<ail;iz++){
			//alert(ai[iz].type);
			if(ai[iz].type=="submit") {
				//alert(ai[iz].disabled);
				ai[iz].disabled==false?ai[iz].disabled="disabled":ai[iz].disabled="";
			}
		}
	}
	function update(i){
		//alert(i);
		//close sub
		closeSub();
		
		//生成信息载体(div)		
		var newDiv	=	document.createElement("div");
		newDiv.id	=	'act';
		newDiv.innerHTML	=	'<div id="zhuangtai" style="font-size:17px;color:red;"><img src="/images/ajax-loader2.gif" />数据更新中...</div><div style="float:left;width:100%;">这个过程中将会耗费您一小段时间,请不要进行其他操作,请耐心等候...</div><div style="clear:both;">更新完后点击窗口,可将其关闭</div><iframe  style="position:absolute;z-index:-1;width:100%;height:100%;top:0;left:0;scrolling:no;" frameborder="0" src="about:blank">';
		newDiv.style.position="absolute";
		newDiv.style.top="110px";
		newDiv.style.left="250px";
		newDiv.style.width="350px";
		newDiv.style.height="380px";
		newDiv.style.border="1px solid #000";
		newDiv.style.overflow="auto";
		newDiv.onclick=new   Function("alert('正在更新中,目前不可中止...');");
		//newDiv.innerHTML	=	'<div style="margin-top:30px;margin-left:300px;margin-bottom:30px"><img src="/images/ajax-loader.gif" />loading...</div>';
		newDiv.style.background="#fff";
		//this.setDisplayStyle("select",   "hidden");
		

		
		document.body.appendChild(newDiv);
//alert('b');

		xajax_pushDate(i,xajax.getFormValues(i));
	}
	//按月的即时添加input
	function addMonthDate(){
		var to=$('max');
		var ta=to.getElementsByTagName('input');
		var tl=ta.length;//有几个input
		var endid=tl/2;//最后生成的有效id标识,将会以one开始||		monthDate及price做基准
		//alert(tl);
		//alert(endid);
		if(endid>=28){
			alert('最大设置数量为28个,您已经为最大了...');
			return false;
		}
		var newSpan=document.createElement("span");
		newSpan.id='one'+endid;
		newSpan.className="setdate";
			newSpan.innerHTML='<div class="at up">							<input type="text" id="monthDate'+endid+'" name="monthDate'+endid+'" value="" style="text-align:center;"  size="3"/>号&nbsp;&nbsp;						</div>						<div class="at down">							<input type="text" name="price'+endid+'" size="6" style="text-align:center;" />:(元)						</div>';

		//to.parentNode.removeChild($('one'));
		to.appendChild(newSpan);
		//document.body.appendChild(newSpan);
	}
	if (document.all){
	 window.attachEvent('onload',changeColor)//对于IE
	}
	else{
	 window.addEventListener('load',changeColor,false);//对于FireFox
	}
	//-->
</script>


<div id="content" class="content1">
	<div id="showDate" style="">

<!--*********************1*************************-->

		<div class="price">
			<div class="priceTitle">按区间调整时时价格</div>
			<form id="qujian" name="qujian" action="javascript:void(0)" method="post" onsubmit="update(this.id)">
				<span style="float:left;">
				<span class="fontC">开始时间:</span>
				<span style="float:left;">
				<input type="text" id="startDate" name="startDate" value="" style="text-align:center;width:90px;"/>
				<img onclick="WdatePicker({el:$dp.$('startDate')})" src="../../jimu/My97/skin/datePicker.gif" width="16" height="22" align="absmiddle" />
				</span >

				<span class="fontC">结束时间:</span>
				<input name="overDate" id="d12" type="text" value="" style="text-align:center;width:90px;"/>
				<img onclick="WdatePicker({el:$dp.$('overDate'),minDate:'%y-%M-#{%d}'})" src="../../jimu/My97/skin/datePicker.gif" width="16" height="22" align="absmiddle">

		<br />
				<span class="fontC">价格(元):</span>
				<input type="text" name="price" size="16" style="text-align:center;"/>
				<input type="hidden" name="bdb" value="<?php echo $priceInfo['tname'];?>">
				<input type="hidden" name="bdgid" value="<?php echo $_GET['bdid'];?>">
				<input type="submit" value="修改" />
				</span>	

			</form>	
		</div>



<!--**********************2************************-->

		
		<div class="price">
			<div class="priceTitle">按[月]区间调整时时价格(记得选择区间的类型，年/月)
				<span>
					[<span style="cursor:pointer;" onclick="addMonthDate();"><img src="/images/add.gif" />添加</span>]
				</span>
			</div>
			<form id="month" name="month" action="javascript:void(0)" method="post" onsubmit="update(this.id)">
				<div><span class="fontC">开始月:</span><span><input id="startMonthDate" name="startMonthDate" type="text" size="13" class="Wdate"  style="text-align:center;" value="<?php echo date("Y-m",time()); ?>" onfocus="WdatePicker({lang:'zh-cn',skin:'whyGreen',dateFmt:'yyyy-MM',minDate:'<?php echo date("Y",time()); ?>-<?php echo date("m",time()); ?>'})" />&nbsp;&nbsp;(将从设置的开始月份开始执行)</span></div>
				<span style="float:left;width:97%;">
					<span class="fontC">每月的:</span>
					<div id="max" style="min-height:30px!important;height:30px;">
					<span id="one" class="setdate">
						<div class="at up">
							<input type="text" id="monthDate" name="monthDate" value="" style="text-align:center;"  size="3"/>号&nbsp;&nbsp;
						</div>
						<div class="at down">
							<input type="text" name="price" size="6" style="text-align:center;" />:(元)
						</div>
					</span >
					</div>
				<br />
				<div style="clear:both;">
					期限:<input type="text" name="qixiang" value="" style="width:60px;text-align:center;"/>&nbsp;<input id="nian" name="qixiantype" onclick="changeColor();" type="radio" value="y" /><label id="nianl"  for="nian">年</label>/<label id="yuel" for="yue">月</label><input id="yue" name="qixiantype" onclick="changeColor();" type="radio" value="m" />
	
					<br />
					<input type="hidden" name="bdb" value="<?php echo $priceInfo['tname'];?>">
					<input type="hidden" name="bdgid" value="<?php echo $_GET['bdid'];?>">
					<input type="submit" value="修改" />
				</div>
				</span>	

			</form>	
		</div>



<!--**********************3************************-->


		
		<div class="price">
			<div class="priceTitle">按[星期]区间调整时时价格</div>
			<form id="week" name="week" action="javascript:void(0)" method="post" onsubmit="update(this.id)">
				<div><span class="fontC">开始日期:</span><span><input id="startWeekDate" name="startWeekDate" type="text" size="13" class="Wdate"  style="text-align:center;" value="<?php echo date("Y-m-d",time()); ?>" onfocus="WdatePicker({isShowClear:false,readOnly:true})" />&nbsp;&nbsp;(将从设置的开始日期开始执行)</span></div>
				<div><span class="fontC">結束日期:</span><span><input id="endWeekDate" name="endWeekDate" type="text" size="13" class="Wdate"  style="text-align:center;" value="" onfocus="WdatePicker({isShowClear:false,readOnly:true})" />&nbsp;&nbsp;(将結束于此日期)</span></div>
				<span style="float:left;">
				<span class="fontC">每周的星期:</span>
					<span><input id="mon" name="weekDate1" type="checkbox" onclick="changeColor();" value="1" /><label id="monl" for="mon">星期一</label></span>
					<span><input id="tue" name="weekDate2" type="checkbox" onclick="changeColor();" value="2" /><label id="tuel" for="tue">星期二</label></span>
					<span><input id="wed" name="weekDate3" type="checkbox" onclick="changeColor();" value="3" /><label id="wedl" for="wed">星期三</label></span>
					<span><input id="thur" name="weekDate4" type="checkbox" onclick="changeColor();" value="4" /><label id="thurl" for="thur">星期四</label></span>
					<span><input id="fri" name="weekDate5" type="checkbox" onclick="changeColor();" value="5" checked="checked" /><label id="fril" for="fri">星期五</label></span>
					<span><input id="sat" name="weekDate6" type="checkbox" onclick="changeColor();" value="6" checked="checked" /><label id="satl" for="sat">星期六</label></span>
					<span><input id="sun" name="weekDate0" type="checkbox" onclick="changeColor();" value="0" /><label id="sunl" for="sun">星期日</label></span>
				<span style="float:left;">
				<!--<input type="text" id="weekDate" name="weekDate" value="" style="width:90px;"/>
						<select id="weekDate" name="weekDate">
							<option value="1">星期一</option>
							<option value="2">星期二</option>
							<option value="3">星期三</option>
							<option value="4">星期四</option>
							<option value="5">星期五</option>
							<option value="6" selected=selected>星期六</option>
							<option value="0">星期日</option>
						</select>-->
				</span >
				<br />
				价格:<input type="text" name="price" size="16" style="text-align:center;"/>
				
				<br />
				<!-- 期限:<input type="text" name="qixiang" value="" style="width:60px;text-align:center;"/>&nbsp;<input id="nians" name="qixiantype" onclick="changeColor();" type="radio" value="y" /><label id="niansl"  for="nians">年</label>/<label id="yue2l" for="yue2">月</label><input id="yue2" name="qixiantype" onclick="changeColor();" type="radio" value="m" />-->
				
				<input type="hidden" name="bdb" value="<?php echo $priceInfo['tname'];?>">
				<input type="hidden" name="bdgid" value="<?php echo $_GET['bdid'];?>">
				<input type="submit" value="修改" />
				</span>	

			</form>	
		</div>



<!--*******************4***************************-->

		
		<div class="price">
			<div class="priceTitle">按准确[时期]调整时时价格</div>
			<form id="day" name="day" action="javascript:void(0)" method="post" onsubmit="update(this.id)">
				<span style="float:left;">
				<span class="fontC">设定:</span>
				<span style="float:left;">
				<input type="text" id="dayDate" name="dayDate" value="" style="text-align:center;width:90px;"/>
				<img onclick="WdatePicker({el:$dp.$('dayDate')})" src="../../jimu/My97/skin/datePicker.gif" width="16" height="22" align="absmiddle">
				</span >
		<br /><br />
				<span class="fontC">价格(元):</span>
				<input type="text" name="price" size="16" style="text-align:center;"/>
				<input type="hidden" name="bdb" value="<?php echo $priceInfo['tname'];?>">
				<input type="hidden" name="bdgid" value="<?php echo $_GET['bdid'];?>">
				<input type="submit" value="修改" />
				</span>	

			</form>	
		</div>


	</div>
</div>
<form action="javascript:void(0)" method="post" enctype="multipart/form-data" onsubmit='return window.location.href=("<?php echo $_SERVER[HTTP_REFERER]; ?>");'>
    <div  align="center"><BR />
		┟<a href="infolist.php?op=list&sortid=<?php echo $_GET['bdsortid']; ?>&bdsortid=<?php echo $_GET['bdparentsortid']; ?>&bdid=<?php echo $_GET['bdparentid']; ?>">返回上一级</a>┦┟<a href="/admin/info/infolistbic.php?op=add&sortid=<?php echo $_GET['sortid']; ?>&bdparentsortid=<?php echo $_GET['bdparentsortid']; ?>&bdparentid=<?php echo $_GET['bdparentid']; ?>&bdsortid=<?php echo $_GET['bdsortid']; ?>&bdid=<?php echo $_GET['bdid']; ?>">查看价格</a>┦
     <!--<input type="submit" value="返回" /></div><br />-->
     <input name="op" type="hidden"  value="<?php echo $_GET[op];?>"   />  
     <input name="gid" type="hidden"  value="<?php echo $_GET[gid];?>"   />  
     <input name="mid" type="hidden"  value="<?php echo $_GET[mid];?>"   />  
     <input name="from" type="hidden"  value="b"   />  
     <input name="bdgid" type="hidden"  value="<?php echo $_GET[bdid];?>"   />  
     <input name="sortid" type="hidden"  value="<?php echo $_GET[sortid];?>"   />  
     <input name="bdb" type="hidden"  value="<?php echo $tname;?>"   />  
     <input name="bdsortid" type="hidden"  value="<?php echo $_GET[bdsortid];?>"   />  
	       
</form>

</body>
</html>
